package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Message;
import com.bohua.child.service.MessageService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 教师表控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/message")
public class MessageController {
    @Resource
    private MessageService messageService;

    @RequestMapping
    public String message(){
        return "message/message.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "message/addMessage.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "message/updateMessage.html";
    }

    @RequestMapping("/getMessages")
    @ResponseBody
    public Lay getMessages(Message message,Integer page,Integer limit){
        return messageService.getMessages(message,page,limit);
    }
    @RequestMapping("/addMessage")
    @ResponseBody
    public Msg addMessage(Message message){
        return messageService.addMessage(message);
    }

    @RequestMapping("/updateMessage")
    @ResponseBody
    public Msg updateMessage(Message message){
        return messageService.updateMessage(message);
    }

    @RequestMapping("/delMessage")
    @ResponseBody
    public Msg delMessage(Message message){
        return messageService.delMessage(message);
    }
}
